﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace InsuranceVehicle.AdminSite
{   
    public partial class Menu : System.Web.UI.UserControl
    {
        private string selectedMenu;

        public string SelectedMenu
        {
            get { return selectedMenu; }
            set { selectedMenu = value; }
        }

        private string showElement; 

        public string ShowElement
        {
            get { return showElement; }
            set { showElement = value; }
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                renderMenu();    
            }
            
        }

        private void renderMenu()
        {
            if (showElement.Equals("all"))
            {
                //menu insurance report
                if (selectedMenu.Equals("report_insurance"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ReportInsurance.aspx\"><span class=\"icon-align-justify\"></span>Insurance Report</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ReportInsurance.aspx\"><span class=\"icon-align-justify\"></span>Insurance Report</a></li>";
                }

                //menu claim report
                if (selectedMenu.Equals("report_claim"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ClaimReport.aspx\"><span class=\"icon-align-justify\"></span>Claim Report</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ClaimReport.aspx\"><span class=\"icon-align-justify\"></span>Claim Report</a></li>";
                }

                //menu add employee
                if (selectedMenu.Equals("add_employee"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"AddEmployee.aspx\"><span class=\"icon-picture\"></span>Add Employee</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"AddEmployee.aspx\"><span class=\"icon-picture\"></span>Add Employee</a></li>";
                }

                //menu update emp info
                if (selectedMenu.Equals("update_info"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"UpdateEmployeeInfo.aspx\"><span class=\"icon-picture\"></span>Manage Account</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"UpdateEmployeeInfo.aspx\"><span class=\"icon-picture\"></span>Manage Account</a></li>";
                }
                 //menu change pass
                if (selectedMenu.Equals("change_pass"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ChangePass.aspx\"><span class=\"icon-picture\"></span>Change password</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ChangePass.aspx\"><span class=\"icon-picture\"></span>Change password</a></li>";
                }

                //menu add insurance type
                if (selectedMenu.Equals("add_insurance"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"AddInsuranceType.aspx\"><span class=\"icon-picture\"></span>Add Insurance Type</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"AddInsuranceType.aspx\"><span class=\"icon-picture\"></span>Add Insurance Type</a></li>";
                }

                //menu add new vehicle
                if (selectedMenu.Equals("add_vehicle"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"NewVehicle.aspx\"><span class=\"icon-picture\"></span>New Vehicle</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"NewVehicle.aspx\"><span class=\"icon-picture\"></span>New Vehicle</a></li>";
                }
            }
            else
            {
                //menu report
                if (selectedMenu.Equals("report_insurance"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ReportInsurance.aspx\"><span class=\"icon-align-justify\"></span>Insurance Report</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ReportInsurance.aspx\"><span class=\"icon-align-justify\"></span>Insurance Report</a></li>";
                }

                //menu claim report
                if (selectedMenu.Equals("report_claim"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ClaimReport.aspx\"><span class=\"icon-align-justify\"></span>Claim Report</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ClaimReport.aspx\"><span class=\"icon-align-justify\"></span>Claim Report</a></li>";
                }


                //menu update emp info
                if (selectedMenu.Equals("update_info"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"UpdateEmployeeInfo.aspx\"><span class=\"icon-picture\"></span>Manage Account</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"UpdateEmployeeInfo.aspx\"><span class=\"icon-picture\"></span>Manage Account</a></li>";
                }

                //menu change pass
                if (selectedMenu.Equals("change_pass"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"ChangePass.aspx\"><span class=\"icon-picture\"></span>Change password</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"ChangePass.aspx\"><span class=\"icon-picture\"></span>Change password</a></li>";
                }

                //menu add insurance
                if (selectedMenu.Equals("add_insurance"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"AddInsuranceType.aspx\"><span class=\"icon-picture\"></span>Add Insurance Type</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"AddInsuranceType.aspx\"><span class=\"icon-picture\"></span>Add Insurance Type</a></li>";
                }

                //menu add new vehicle
                if (selectedMenu.Equals("add_vehicle"))
                {
                    menuArea.Text += "<li class=\"active\"><a href=\"NewVehicle.aspx\"><span class=\"icon-picture\"></span>New Vehicle</a></li>";
                }
                else
                {
                    menuArea.Text += "<li><a href=\"NewVehicle.aspx\"><span class=\"icon-picture\"></span>New Vehicle</a></li>";
                }
            }
            
        }
    }
}